package design;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author: hero生仔
 */
public abstract class AuthLink {
    protected SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 时间格式化
    protected String levelUserId; // 级别⼈员ID
    protected String levelUserName; // 级别⼈员姓名
    private AuthLink next; // 责任链，这是重点，链接起来的核心

    public AuthLink(String levelUserId, String levelUserName) {
        this.levelUserId = levelUserId;
        this.levelUserName = levelUserName;
    }
    public AuthLink next() {
        return next;
    }

    /**
     * 通过 next 方式获取下一个链路需要处理的节点
     * @param next
     * @return
     */
    public AuthLink appendNext(AuthLink next) {
        this.next = next;
        return this;
    }
    public abstract AuthInfo doAuth(String uId, String orderId, Date authDate);
}
